#include"Tokenizer.h"
Tokenizer::Tokenizer(void):m_Buffer(NULL),
m_BufferLen(0),
m_FileName(NULL),
m_TokenIndex(0),
m_LineNum(0),
m_ColumnNum(0)					
{
	
}

Tokenizer::Tokenizer(const QString& filename,const QTextStream& fp)
{
	if(!filename.isEmpty())
	{
		m_FileName = filename;
		m_Buffer = fp.readAll();
	}
	else
	{
		m_FileName = NULL;
		m_Buffer = NULL;
	}
	BaseInit();
}
Tokenizer::~Tokenizer()
{

}

Tokenizer::BaseInit()
{
	m_BufferLen = 0;
	m_TokenIndex = 0;
	m_LineNum = 0;
	m_ColumnNum = 0;
}

false Tokenizer::SkipComment()
{
	while(!IsEOF())
	{
		if(CurrentChar() == QChar('*') || NextChar() == QChar('/'))
		{
			MoveNextChar();
			MoveNextChar();
			return true;
		}
	}
	return false;
}

bool Tokenizer::SkipWhiteSpace()
{
	while(!IsEOF())
	{
		if(CurrentChar() == QChar(' '))
		{
			MoveNextChar();
		}
		else
			return true;
	}
	return false;
}

bool Tokenizer::MoveNextLine()
{
	while(!IsEOF())
	{
		if(CurrentChar() == QChar('\n'))
		{
			MoveNextChar();
			return true;
		}
		MoveNextChar();
	}
	return false;
}

/*
 jump [,( ,#,

*/
bool Tokenizer::SkipBlock(const QChar& ch)
{
	while(!IsEOF())
	{
		QString = ("\'skdsldj\'")
	}

}

bool Tokenizer::SkipUnWant()
{
}
